﻿@using JT.WEB.Models.Were
@model JT.WEB.Views.PaginatedList<TbChuRuInfo>
@{
    ViewData["Title"] = "出入库管理";
}


<div class="table-responsive-sm">
    <table class="table table-hover table-bordered table-sm text-center">
        <thead>
            <tr class="table-success">
                <th>

                    <a asp-action="Index" asp-route-sortOrder="@ViewData[" NameSortParm"]"
                       asp-route-currentFilter="@ViewData["CurrentFilter"]">编号</a>
                </th>
                <th>


                    <a asp-action="Index" asp-route-sortOrder="@ViewData["DateSortParm"]"
                       asp-route-currentFilter="@ViewData["CurrentFilter"]">操作日期</a>
                </th>
                <th>
                    @* @Html.DisplayNameFor(model => model.ItemNameNavigation)*@
                    @* <a asp-action="Index" asp-route-sortOrder="@ViewData[" NameSortParm"]">@Html.DisplayNameFor(model
                        => model.ItemNameNavigation)</a>*@
                    <a asp-action="Index" asp-route-sortOrder="@ViewData["NameSortParm"]"
                       asp-route-currentFilter="@ViewData["CurrentFilter"]">物品</a>

                </th>
                <th>
                    @*<a asp-action="Index" asp-route-sortOrder="@ViewData[" NameSortParm"]">@Html.DisplayNameFor(model
                        => model.IsRuKu)</a>*@
                    <a asp-action="Index" asp-route-sortOrder="@ViewData["NameSortParm"]"
                       asp-route-currentFilter="@ViewData["CurrentFilter"]">事件</a>

                </th>
                <th>

                    <a asp-action="Index" asp-route-sortOrder="@ViewData["NameSortParm"]"
                       asp-route-currentFilter="@ViewData["CurrentFilter"]">数量</a>


                </th>
                <th>

                    <a asp-action="Index" asp-route-sortOrder="@ViewData[" NameSortParm"]"
                       asp-route-currentFilter="@ViewData[" CurrentFilter"]">单位</a>

                </th>
                <th>

                    <a asp-action="Index" asp-route-sortOrder="@ViewData["NumberSortParm"]"
                       asp-route-currentFilter="@ViewData["CurrentFilter"]">库存</a>

                </th>


                <th>
                    @* <a asp-action="Index" asp-route-sortOrder="@ViewData[" NameSortParm"]">@Html.DisplayNameFor(model
                        => model.NamePersonNavigation)</a>*@
                    <a asp-action="Index" asp-route-sortOrder="@ViewData["NameSortParm"]"
                       asp-route-currentFilter="@ViewData["CurrentFilter"]">操作人</a>

                </th>
                <th>
                    删除
                </th>
            </tr>
        </thead>
        <tbody>
            @foreach (TbChuRuInfo item in Model)
            {
                <tr>
                    <td>
                        @Html.DisplayFor(modelItem => item.ChuRuId)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.ChangeDate)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.ItemNameNavigation.ItemName)
                    </td>
                    <td>
                        @if (item.IsRuKu == IsRuKu.inStock)
                        {
                            <span class="badge badge-pill badge-success">入库</span>
                        }
                        else
                        {
                            <span class="badge badge-pill badge-danger">出库</span>
                        }
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Count)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.ItemNameNavigation.UnitName)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.ItemNameNavigation.Inventory)
                    </td>


                    <td>
                        @Html.DisplayFor(modelItem => item.Recorder)
                    </td>
                    <td>
                        @*<a asp-action="Details" asp-route-id="@item.ChuRuId">详情</a>*@
                        <form asp-action="Delete" method="post">
                            <input asp-for="tbChuRuInfo.ChuRuId" hidden="hidden" />
                            <button type="submit" asp-action="Delete" asp-route-id="@item.ChuRuId" class="btn btn-sm btn-danger" data-toggle="tooltip" data-placement="top" title="删除"><span class="fa fa-trash"></span></button>
                        </form>
                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>
@{
    var prevDisabled = !Model.HasPreviousPage ? "disabled" : "";
    var nextDisabled = !Model.HasNextPage ? "disabled" : "";
}

<a asp-action="Index" asp-route-sortOrder="@ViewData["CurrentSort"]" asp-route-pageNumber="@(Model.PageIndex - 1)"
   asp-route-currentFilter="@ViewData["CurrentFilter"]" class="btn btn-line-success  @prevDisabled">
    上一页
</a>
<a asp-action="Index" asp-route-sortOrder="@ViewData["CurrentSort"]" asp-route-pageNumber="@(Model.PageIndex + 1)"
   asp-route-currentFilter="@ViewData["CurrentFilter"]" class="btn btn-line-success @nextDisabled">
    下一页
</a>
<!-- Button trigger modal -->
<button type="button" class="btn btn-outline-success" data-toggle="modal" data-target="#exampleModal">
    增加出入信息
</button>
<partial name="test" />

<!-- 增加出入信息 -->
@section Scripts {
    @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}
<script>
    $(document).ready(function(){
    $('[data-toggle="tooltip"]').tooltip();
});
</script>